package Utils
{
	/**
	 * Basic Array Methods plus:<br>
	 * - <b>contains</b>(objectToSearch:Object):Boolean<br>
	 * - <b>containsByProperty</b>(objectToSearch:Object, property:String):Boolean<br>
	 * - <b>removeItem</b>(objectToRemove:Object):void<br>
	 * <br>
	 * Last Update : 4 Aout 2011
	 */
	public dynamic class MyArray extends Array
	{		
		/**
		 * 
		 */
		public function MyArray()
		{
			super();
		}
		
		
		/**
		 * 
		 */
		public function contains(objectToSearch:Object):Boolean
		{
			for each (var obj:Object in this)
				if (obj == objectToSearch)
					return true;
			return false;
		}
		
		
		/**
		 * 
		 */
		public function containsByProperty(objectToSearch:Object, property:String):Boolean
		{
			for each (var obj:Object in this)
				if (obj.hasOwnProperty(property) && obj[property] == objectToSearch)
					return true;
			return false;
		}
		
		
		/**
		 * 
		 */
		public function removeItem(objectToRemove:Object):void
		{
			for (var i:int = 0 ; i < length ; ++i)
				if (this[i] == objectToRemove)
				{
					splice(i, 1);
					return;
				}
		}
		
		
	} // ! class
}